<include file="Public/header" title="添加文章" />

<script></script>
<div id="page-wrapper">
    <form method="post" action="{:U('post/add')}" enctype="multipart/form-data">
        <div class="form-group">
            <label for="post-title">文章标题</label>
            <input type="text" name="title" class="form-control" id="post-title" placeholder="输入文章标题">
        </div>
        <div class="form-group">
            <label for="post-cate">文章分类</label>
            <select name="cate_id" id="post-cate" class="form-control">
                <foreach name="category" item="v">
                    <option value="{$v.id}">{$v.html} {$v.title}</option>
                </foreach>
            </select>
        </div>
        <div class="form-group">
            <label for="post-content">文章内容</label>
            <input id="post-content" name="content" type="text">
        </div>
        <div id="imgs" >
        <div class="form-group" style="margin-bottom:20px;">
            <label for="exampleInputEmail2">图片1</label>
            <input type="file" class="form-control" name="img" id="exampleInputEmail2" placeholder="下拉值2">
        </div>

        </div>
        <div  class="btn btn-default" id="more" style="margin-top:0px;">添加更多图片</div>



        <button type="submit" class="btn btn-danger" style="margin-left:50px">提交</button>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/jquery-1.11.3.js"></script>

<script type="text/javascript">
    $(function()
    {
        $(":radio").change(function(){
            var select=  $('#select').prop("checked");

            if(select)
            {
                $("#xiala").css({"display":"block"});
            }else{
                $("#xiala").css({"display":"none"});
            }
        });

        var i = 3;
        $("#more").click(function(){
            var html= "<div class='form-group' ><label >新增图片</label> " +
                "<input type='file' class='form-control' name='img"+i+"' placeholder='新增图片'> " +
                "</div >";
            i++;

            $('#imgs').append(html);


        })



    })
</script>
<include file="Public/footer" />